﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.IO;
namespace MapEditor
{
    class QuadTree
    {
        private QNode _root;
        public QuadTree(Rectangle bound)
        {
            _root = new QNode(0, Area.none, bound);
        }
        public void Build(List<GameObject> list)
        {
            foreach (GameObject item in list)
            {
                _root.AddObj(item);
            }
        }

        public void SaveFileQuadTree(string fileNode)
        {
            List<string> nodeList = new List<string>();
            _root.SerializeQ(nodeList);

            StreamWriter swNode = new StreamWriter(fileNode);
            //swNode.WriteLine(RealMapWidth.ToString());
            foreach (var item in nodeList)
                swNode.WriteLine(item);
           
            swNode.Close();
        }
    }
}
